﻿using System;
using System.Collections.Generic;
using System.Text;
using FeCMS.Entity.AccessControlModule;
using FeCMS.CommonFunction;

namespace FeCMS.AccessControlModule.handle
{
    /// <summary>
    ///     管理员操作
    /// </summary>
    internal class AdminHandle : BaseHandle<Admin, string>
    {
        public AdminHandle(Dictionary<string, Admin> obj)
            : base(obj)
        { 

        }
        

        public bool Add(Admin e)
        {
            //修改角色排序与权限排序
            Algorithm.QuickSort(e.RoleID, 0, e.RoleID.Length - 1);
            Algorithm.QuickSort(e.PrivatePermission, 0, e.PrivatePermission.Length - 1);
            return Add(e.UserName, e);
        }

        public override bool Edit(string i, Admin e)
        {
            //修改角色排序与权限排序
            Algorithm.QuickSort(e.RoleID, 0, e.RoleID.Length - 1);
            Algorithm.QuickSort(e.PrivatePermission, 0, e.PrivatePermission.Length - 1);
            return base.Edit(i, e);
        }
    }
}
